{$layout}

<!-- 检测配置是否有更新 begins -->
<p class="ui message warning proxy-changed" v-if="statusChanged">代理服务已被修改，<a href="" v-on:click.prevent="restart()">点此重启后生效</a></p>

{$var "header"}
<link rel="stylesheet" href="/_/@default/proxy/@global.css"/>
<script type="text/javascript" src="/_/@default/proxy/@global.js"></script>

<script src="/codemirror/lib/codemirror.js" type="text/javascript"></script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css" type="text/css"/>
<script src="/codemirror/mode/nginx/nginx.js" type="text/javascript"></script>
<link rel="stylesheet" href="/codemirror/theme/idea.css" type="text/css"/>
<script src="/codemirror/addon/selection/active-line.js" type="text/javascript"></script>
<script src="/codemirror/addon/edit/matchbrackets.js" type="text/javascript"></script>
{$end}
<!--  检测配置是否有更新 end -->

<div>
    <h3>{{proxy.description}}<span>（{{filename}}）</span></h3>

    {$template "menu"}

    <p><i class="icon info circle"></i>如果你需要在TeaWeb之前加入一个代理服务，可以使用以下的配置：</p>

    <table class="ui table selectable">
        <thead>
            <tr>
                <th>nginx - <em>将下面配置加入到 nginx.conf 文件中的 http 内容中，然后重启或重载（reload） nginx服务后生效</em></th>
            </tr>
        </thead>
        <tr>
            <td>
                <div class="code nginx">server {
    # nginx address
    listen 80;
    server_name {{proxy.name.join(' ')}};

    # max request body size
    #client_max_body_size 128M;

    location / {
        # set request headers
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;

        # teaweb bind address
        proxy_pass http://<span v-if="proxy.listen.length > 0">{{proxy.listen[0]}}</span><span v-if="proxy.listen.length == 0" class="disabled">[请先绑定网络地址]</span>;
    }
}</div>
            </td>
        </tr>
    </table>
</div>